package com.xbongbong.pro.statistic.model.impl;

import com.xbongbong.bi.domain.DataSetDao;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.PinyinUtil;
import com.xbongbong.pro.domain.entity.DataSetEntity;
import com.xbongbong.pro.statistic.model.DataSetModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 描述信息
 *
 * @ClassName DataSetModelImpl
 * @Author 梁鲁江
 * 创建时间 2022/5/19 19:16
 * 修改时间  2022/5/19 19:16
 **/
@Service("dataSetModel")
public class DataSetModelImpl implements DataSetModel {
    private static final Object PINYIN_COLUMNS = "id, corpid, name,name_en,memo,status,execute_time,permission,board,creator_id, del, add_time, update_time, edit_time, del, " + PinyinUtil.formatFirstPinyinStr("name") + " as firstPinyin";
    @Resource
    private DataSetDao dao;

    @Override
    public Integer insert(DataSetEntity entity) throws XbbException {
        return dao.insert(entity);
    }

    @Override
    public Integer update(DataSetEntity entity) throws XbbException {
        return dao.update(entity);
    }

    @Override
    public List<DataSetEntity> findEntitys(Map<String, Object> param) {
        return dao.findEntitys(param);
    }

    @Override
    public List<DataSetEntity> findEntitysOrderByPinyin(Map<String, Object> param) {
        param.put("columns", PINYIN_COLUMNS);
        return dao.findEntitysOrderByPinyin(param);
    }

    @Override
    public DataSetEntity getByKey(Long key, String corpid){
        return dao.getByKey(key , corpid);
    }


    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return dao.getEntitysCount(param);
    }

    @Override
    public List<String> getCreatorIdList(String corpid) {
        return dao.getCreatorIdList(corpid);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
}
